<h1>Ajouter une séance</h1>
<?php 
$user=$_SESSION["utilisateur"];
$numEnseignant=$user["NumUtilisateur"];
?>

<div class="formAjoutSeance">﻿
    <?php echo isset($msgErreur)?"<span class=\"msgErreur\" >$msgErreur</span>":"";?>
    <form name="filtre" method="POST" action="index.php?controller=seance&action=enregistrerSeance">

        <table
             <tr>
                <th>
                    <label for="name">Matière *:</label>
                </th>
                <td>
                    <select name="numEp" <?php echo $form->getErreur("numEP")?"class='champObligatoire'":""; ?> id='fieldEp'>
                            <option value=""></option>
                        <?php foreach ($listEP as $key => $ep) {
                        ?><option value='<?php echo $ep["numEP"] ?>' <?php echo ($ep["numEP"]==$form->getNumEP()?"selected='selected'":"") ?> ><?php echo $ep["libelleEP"]?></option>
                        <?php }?>
                        </select><br />
                </td>
            </tr>
            <tr>
                <th>
                    <br><label for="numero">Numéro séance *:</label>
                    
                </th>
                <td>
                    <br/>
                    <select name="numero" <?php echo $form->getErreur("numero")?"class='champObligatoire'":""; ?> >
                        <?php for ($i = 1; $i < 30; $i++) {?>
                            <option value="<?php echo $i;?>" <?php echo ($i==$form->getNumero()?"selected='selected'":"") ?>><?php echo $i;?></option>
                        <?php }?>
                    </select>
                </td>
            </tr>
            <tr>
                <th>
                    <br><label for="libelleSeance">Libelle séance *:</label>
                </th>
                <td>
                    <br><input <?php echo $form->getErreur("libelleSeance")?"class='champObligatoire'":""; ?> type="text" size="20" value ="<?php echo $form->getLibelleSeance();?>" name="libelleSeance"  style="cursor: text" /><br />
                </td>
            </tr>
            <tr>
                <th>
                    <br><label for="dateSeance">Date séance *:</label>
                </th>
                <td>
                    <br><input  type="text" class="date<?php echo $form->getErreur("dateSeance")?" champObligatoire":""; ?>" size="20" value="<?php echo $form->getDateSeance();?>" name="dateSeance" style="cursor: text" />
                    <input type="text" class="time<?php echo $form->getErreur("timeSeance")?" champObligatoire":""; ?>" size="2" name="timeSeance" value="<?php echo $form->getTimeSeance();?>" style="cursor: text" />
                
                </td>
            </tr>
            <tr>
                <th>
                    <br><label for="groupe">Groupe :</label>
                </th>
                <td>
                    <br/>
                    <select name="groupe"  id="fieldGroupe">
                        <option value=""> </option>
                        <?php
                            foreach ($listGroupes as $key => $groupe) {?>
                            
                                <option value="<?php echo $groupe["idgrp"];?>" <?php echo ($groupe["idgrp"]==$form->getGroupe()?"selected='selected'":"") ?>><?php echo $groupe["numgrp"];?></option>
                            
                            <?php } ?>
                    </select>

                </td>
            </tr>
            <tr>
                <td></td>
                <td><input value="Enregistrer" type="submit" class="right action btn btn-default"/></td>
            </tr>
        </table>

    </form>
</div>    
<script language="javascript">
$( document ).ready((function() {
    $("#fieldEp").change(function () {
        $( "#fieldGroupe" ).load( "index.php?controller=seance&action=ajaxGetGroupes&numEp="+$("#fieldEp").val());
    });
}));
</script>
